;; Title:        GPA Calculator
;; Description:  Calculate a GPA out of 4.

(setf gpa 0
      total-credit-hours 0)

(format t "This program will calculate your GPA.~%Enter zero for credit hours to stop entering new courses~%")

(loop while t do
      (format t "~%New Course~%Credit hours: ")
      (setf credit-hours (read))
      (if (zerop credit-hours)
	  (progn
	    (format t "~%Done entering courses~%")
	    (return))	
	(progn
	  (format t "Grade points: ")
	  (setf grade-points (read))))
      (setf gpa (+ gpa (* credit-hours grade-points)))
      (setf total-credit-hours (+ total-credit-hours credit-hours))
      )

(setf gpa (/ gpa total-credit-hours))

(format t "~%Your GPA: ~$~%" gpa)
